package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 *  对象流:处理流/高级流
 * ------ObjectInputStream和ObjectOutputStream
 *   作用: -----进行对象的序列化和反序列化
 *   对象序列化: -----将一个java对象转换为一组字节的过程称为对象序列化
 *   对象反序列化: -----将一组字节还原为java对象
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "张三";
        int age = 22;
        String gender = "男";
        String[] otherInfo = {"是一名学生","爱打篮球","喜欢串背带裤"};
        Student zs = new Student(name,age,gender,otherInfo);
        System.out.println(zs);

        FileOutputStream fos = new FileOutputStream("student.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("写出完成");
        oos.close();




    }
}